<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui, viewport-fit=cover">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <title>My App</title>
    <link rel="stylesheet" href="../../packages/core/css/framework7.min.css">
    <link rel="stylesheet" href="../../css/framework7-icons.css">
  </head>
  <body>
    <div id="app"></div>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <script src="https://unpkg.com/react@16.4.1/umd/react.production.min.js"></script>
    <script src="https://unpkg.com/react-dom@16.4.1/umd/react-dom.production.min.js"></script>
    <script src="../../packages/react/framework7-react.min.js"></script>
    <script src="../../packages/core/js/framework7.min.js"></script>
    <script type="text/babel">
      class AppComponent extends React.Component {
        constructor() {
          super();
      
          this.state = {
            mounted: false,
          };
        }
        componentDidMount() {
          const self = this;
          setTimeout(()=>{
            self.setState({mounted: true})
          },0);
        }
        render() {
          return (
            <App>
              <View main>
                <Page>
                  <Navbar title="Smart Select"></Navbar>
                  {this.state.mounted && (
                    <List>
                      <ListItem title="Fruit" smartSelect>
                        <select name="fruits" defaultValue="apple">
                          <option value="apple">Apple</option>
                          <option value="pineapple">Pineapple</option>
                          <option value="pear">Pear</option>
                          <option value="orange">Orange</option>
                          <option value="melon">Melon</option>
                          <option value="peach">Peach</option>
                          <option value="banana">Banana</option>
                        </select>
                      </ListItem>
                      <ListItem title="Car" smartSelect smartSelectParams={{openIn: 'popup', searchbar: true, searchbarPlaceholder: 'Search car'}}>
                        <select name="car" multiple defaultValue={['honda', 'audi', 'ford']}>
                          <optgroup label="Japanese">
                            <option value="honda">Honda</option>
                            <option value="lexus">Lexus</option>
                            <option value="mazda">Mazda</option>
                            <option value="nissan">Nissan</option>
                            <option value="toyota">Toyota</option>
                          </optgroup>
                          <optgroup label="German">
                            <option value="audi">Audi</option>
                            <option value="bmw">BMW</option>
                            <option value="mercedes">Mercedes</option>
                            <option value="vw">Volkswagen</option>
                            <option value="volvo">Volvo</option>
                          </optgroup>
                          <optgroup label="American">
                            <option value="cadillac">Cadillac</option>
                            <option value="chrysler">Chrysler</option>
                            <option value="dodge">Dodge</option>
                            <option value="ford">Ford</option>
                          </optgroup>
                        </select>
                      </ListItem>
                      <ListItem title="Mac or Windows" smartSelect smartSelectParams={{openIn: 'sheet'}}>
                        <select name="mac-windows" defaultValue="mac">
                          <option value="mac">Mac</option>
                          <option value="windows">Windows</option>
                        </select>
                      </ListItem>
                      <ListItem title="Super Hero" smartSelect smartSelectParams={{openIn: 'popover'}}>
                        <select name="superhero" multiple defaultValue={['Batman']}>
                          <option value="Batman">Batman</option>
                          <option value="Superman">Superman</option>
                          <option value="Hulk">Hulk</option>
                          <option value="Spiderman">Spiderman</option>
                          <option value="Ironman">Ironman</option>
                          <option value="Thor">Thor</option>
                          <option value="Wonder Woman">Wonder Woman</option>
                        </select>
                      </ListItem>
                    </List>
                  )}
                </Page>
              </View>
            </App>
          )
        }
      }
    </script>
    <script>
      var theme = 'ios';
      if (location.href.indexOf('theme=md') >= 0) theme = 'md';
      
      if (Framework7.use) Framework7.use(Framework7React, { theme: theme });
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(Framework7React, { theme: theme });
      
      var plugin = {
        params: {
          theme: theme,
        }
      };
      
      if (Framework7.use) Framework7.use(plugin);
      else if (Framework7.Class && Framework7.Class.use) Framework7.Class.use(plugin);
      
      window.onload = function () {
        if (typeof AppComponent !== 'undefined') {
          ReactDOM.render(
            React.createElement(AppComponent),
            document.getElementById('app')
          );
        }
      }
    </script>
  </body>
</html>